This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.
Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Ctrl+Shift+Enter.
source("tianfengRwrappers.R")
载入需要的程辑包:dplyr
载入程辑包:‘dplyr’
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
载入需要的程辑包:reticulate
载入需要的程辑包:tidyr
载入程辑包:‘MySeuratWrappers’
The following objects are masked from ‘package:Seurat’:
DimPlot, DoHeatmap, LabelClusters, RidgePlot, VlnPlot
载入程辑包:‘cowplot’
The following object is masked from ‘package:ggpubr’:
get_legend
载入需要的程辑包:viridisLite
载入程辑包:‘reshape2’
The following object is masked from ‘package:tidyr’:
smiths
NOTE: Either Arial Narrow or Roboto Condensed fonts are required to use these themes.
Please use hrbrthemes::import_roboto_condensed() to install Roboto Condensed and
if Arial Narrow is not on your system, please see https://bit.ly/arialnarrow
clusterProfiler v3.14.3 For help: https://guangchuangyu.github.io/software/clusterProfiler
If you use clusterProfiler in published research, please cite:
Guangchuang Yu, Li-Gen Wang, Yanyan Han, Qing-Yu He. clusterProfiler: an R package for comparing biological themes among gene clusters. OMICS: A Journal of Integrative Biology. 2012, 16(5):284-287.
Registering fonts with R
载入程辑包:‘plotly’
The following object is masked from ‘package:ggplot2’:
last_plot
The following object is masked from ‘package:stats’:
filter
The following object is masked from ‘package:graphics’:
layout
载入需要的程辑包:Biobase
载入需要的程辑包:BiocGenerics
载入需要的程辑包:parallel
载入程辑包:‘BiocGenerics’
The following objects are masked from ‘package:parallel’:
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply,
parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from ‘package:dplyr’:
combine, intersect, setdiff, union
The following objects are masked from ‘package:stats’:
IQR, mad, sd, var, xtabs
The following objects are masked from ‘package:base’:
anyDuplicated, append, as.data.frame, basename, cbind, colnames, dirname, do.call, duplicated, eval,
evalq, Filter, Find, get, grep, grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget, order,
paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, Reduce, rownames, sapply, setdiff, sort,
table, tapply, union, unique, unsplit, which, which.max, which.min
Welcome to Bioconductor
Vignettes contain introductory material; view with 'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
载入需要的程辑包:e1071
载入程辑包:‘widgetTools’
The following object is masked from ‘package:dplyr’:
funs
载入程辑包:‘DynDoc’
The following object is masked from ‘package:BiocGenerics’:
path
载入程辑包:‘DT’
The following object is masked from ‘package:Seurat’:
JS
========================================
circlize version 0.4.13
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: https://jokergoo.github.io/circlize_book/book/
If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization
in R. Bioinformatics 2014.
This message can be suppressed by:
suppressPackageStartupMessages(library(circlize))
========================================
载入需要的程辑包:grid
========================================
ComplexHeatmap version 2.2.0
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference
If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional
genomic data. Bioinformatics 2016.
========================================
载入程辑包:‘ComplexHeatmap’
The following object is masked from ‘package:plotly’:
add_heatmap
library(org.Hs.eg.db)
载入需要的程辑包:AnnotationDbi
载入需要的程辑包:stats4
载入需要的程辑包:IRanges
载入需要的程辑包:S4Vectors
载入程辑包:‘S4Vectors’
The following object is masked from ‘package:plotly’:
rename
The following object is masked from ‘package:tidyr’:
expand
The following objects are masked from ‘package:dplyr’:
first, rename
The following object is masked from ‘package:base’:
expand.grid
载入程辑包:‘IRanges’
The following object is masked from ‘package:plotly’:
slice
The following objects are masked from ‘package:dplyr’:
collapse, desc, slice
载入程辑包:‘AnnotationDbi’
The following object is masked from ‘package:plotly’:
select
The following object is masked from ‘package:dplyr’:
select
library(msigdbr)
library(GSVA)
library(fgsea)
载入需要的程辑包:Rcpp
library(UCell)
```r
select.cells <- CellSelector(plot = DimPlot(ds2, reduction = \umap\)) #去除边角的离群细胞
ds2 <- subset(ds2, cell = select.cells)
# saveRDS(ds2,\ds2.rds\)
umapplot(ds2,split.by = \conditions\)
ds2 <- ds2 %>% FindNeighbors(dims = 1:20) %>% FindClusters(resolution = 0.15)
umapplot(ds2, group.by = \seurat_clusters\,split.by = \conditions\)
Idents(ds2) <- ds2$conditions
ds2_AC <- subset(ds2, idents = \AC\)
ds2_PA <- subset(ds2, idents = \PA\)
ds2_AC <- ds2_AC %>% FindNeighbors(dims = 1:20) %>% FindClusters(resolution = 0.1)
ds2_PA <- ds2_PA %>% FindNeighbors(dims = 1:20) %>% FindClusters(resolution = 0.1)
umapplot(ds2_AC) + scale_y_continuous(limits = c(-5,15),breaks = NULL) +
scale_x_continuous(limits = c(-5,15),breaks = NULL)
umapplot(ds2_PA)+ scale_y_continuous(limits = c(-5,15),breaks = NULL) +
scale_x_continuous(limits = c(-5,15),breaks = NULL)
<!-- rnb-source-end -->
<!-- rnb-chunk-end -->
<!-- rnb-text-begin -->
## find markers
<!-- rnb-text-end -->
<!-- rnb-chunk-begin -->
<!-- rnb-source-begin eyJkYXRhIjoiYGBgclxuZHMyX21hcmtlcnMgPC0gRmluZEFsbE1hcmtlcnMoZHMyLCBsb2dmYy50aHJlc2hvbGQgPSAwLjUsIG1pbi5kaWZmLnBjdCA9IDAuMiwgb25seS5wb3MgPSBGKVxuYGBgIn0= -->
```r
ds2_markers <- FindAllMarkers(ds2, logfc.threshold = 0.5, min.diff.pct = 0.2, only.pos = F)
Calculating cluster SMC1
Calculating cluster Fibromyocyte
Calculating cluster Pericyte
Calculating cluster Fibroblast
Calculating cluster SMC2
ds2_markers_pos <- ds2_markers[ds2_markers$avg_logFC>0, ]
ds2_markers_neg <- ds2_markers[ds2_markers$avg_logFC<0, ]
exprmat <- get_data_table(ds2, highvar = T,type = "data")
clusterinfo <- ds2@meta.data[,c("orig.ident","Classification1")]
mbd <- msigdbr(species = "Homo sapiens", category = "C7") # C7 免疫
msigdbr_list <- split(x = mbd$gene_symbol, f = mbd$gs_name)
immo_res <- gsva(exprmat, msigdbr_list, kcdf="Gaussian",method = "gsva", parallel.sz = 6) #gsva 在server上运行
pheatmap(immo_res, show_rownames=1, show_colnames=0,
annotation_col=clusterinfo,fontsize_row=5, wiidth=8, height=6)#绘制热图
es <- data.frame(t(immo_res),stringsAsFactors=F) #添加到单细胞矩阵中,可视化相关通路的在umap上聚集情况,可理解为一个通路即一个基因
dataset1 <- AddclusterinfoData(pbmc, es)
FeaturePlot(dataset1, features = "KEGG_PRIMARY_BILE_ACID_BIOSYNTHESIS", reduction = 'umap')
#GSEA
geneset <- read.table("fibromyo")
dataset1 <- AddModuleScore(dataset1,features = geneset, name = 'fibromyo_score')
f("fibromyo_score1", dataset1, min.cutoff = 0)
dataset1 <- AddModuleScore_UCell(dataset1,features = geneset, name = 'fibromyo_score')
f("V1fibromyo_score", dataset1)
umapplot(ds2)
ds2_markers <- FindMarkers(ds2,ident.1 = "SMC2",min.diff.pct = 0.2, logfc.threshold = 0.5)
| | 0 % ~calculating
|+ | 2 % ~00s
|++ | 4 % ~00s
|+++ | 6 % ~00s
|++++ | 8 % ~00s
|+++++ | 10% ~00s
|++++++ | 12% ~00s
|+++++++ | 14% ~00s
|++++++++ | 16% ~00s
|+++++++++ | 18% ~00s
|++++++++++ | 20% ~00s
|+++++++++++ | 22% ~00s
|++++++++++++ | 24% ~00s
|+++++++++++++ | 26% ~00s
|++++++++++++++ | 28% ~00s
|+++++++++++++++ | 30% ~00s
|++++++++++++++++ | 32% ~00s
|+++++++++++++++++ | 34% ~00s
|++++++++++++++++++ | 36% ~00s
|+++++++++++++++++++ | 38% ~00s
|++++++++++++++++++++ | 40% ~00s
|+++++++++++++++++++++ | 42% ~00s
|++++++++++++++++++++++ | 44% ~00s
|+++++++++++++++++++++++ | 46% ~00s
|++++++++++++++++++++++++ | 48% ~00s
|+++++++++++++++++++++++++ | 50% ~00s
|++++++++++++++++++++++++++ | 52% ~00s
|+++++++++++++++++++++++++++ | 54% ~00s
|++++++++++++++++++++++++++++ | 56% ~00s
|+++++++++++++++++++++++++++++ | 58% ~00s
|++++++++++++++++++++++++++++++ | 60% ~00s
|+++++++++++++++++++++++++++++++ | 62% ~00s
|++++++++++++++++++++++++++++++++ | 64% ~00s
|+++++++++++++++++++++++++++++++++ | 66% ~00s
|++++++++++++++++++++++++++++++++++ | 68% ~00s
|+++++++++++++++++++++++++++++++++++ | 70% ~00s
|++++++++++++++++++++++++++++++++++++ | 72% ~00s
|+++++++++++++++++++++++++++++++++++++ | 74% ~00s
|++++++++++++++++++++++++++++++++++++++ | 76% ~00s
|+++++++++++++++++++++++++++++++++++++++ | 78% ~00s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~00s
|+++++++++++++++++++++++++++++++++++++++++ | 82% ~00s
|++++++++++++++++++++++++++++++++++++++++++ | 84% ~00s
|+++++++++++++++++++++++++++++++++++++++++++ | 86% ~00s
|++++++++++++++++++++++++++++++++++++++++++++ | 88% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++ | 92% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++ | 94% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 96% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++++ | 98% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s
ds2_markers_pos <- ds2_markers[ds2_markers$avg_logFC>0, ]
ds2_markers_neg <- ds2_markers[ds2_markers$avg_logFC<0, ]
library(org.Hs.eg.db)
gene_list <- rownames(ds2_markers_pos)
up_enrich.go <- enrichGO(
gene = gene_list, # 基因列表文件中的基因名称
OrgDb = org.Hs.eg.db, keyType = "SYMBOL",
ont = "BP", # 可选 BP、MF、CC,也可以指定 ALL 同时计算 3 者
pAdjustMethod = "fdr", pvalueCutoff = 0.05, qvalueCutoff = 0.2)
ggobj <- dotplot(up_enrich.go, showCategory = 10) + theme_classic() +
theme(text = element_text(colour = "black", size = 16),
plot.title = element_text(size = 16,color="black",hjust = 0.5),
axis.title = element_text(size = 16,color ="black"),
axis.text = element_text(size= 16,color = "black"))
ggsave("ds2SMC2_up_enrich.svg",device = svg, plot = ggobj, width = 10, height = 6)
ggsave("ds2SMC2_up_enrich2.svg",device = svg, plot = cnetplot(up_enrich.go, showCategory = 8, colorEdge = T), width = 10, height = 6)
emapplot(up_enrich.go, showCategory = 10)
##down-regulated genes
gene_list <- rownames(ds2_markers_neg)
down_enrich.go <- enrichGO(
gene = gene_list, # 基因列表文件中的基因名称
OrgDb = org.Hs.eg.db, keyType = "SYMBOL",
ont = "BP", # 可选 BP、MF、CC,也可以指定 ALL 同时计算 3 者
pAdjustMethod = "fdr", pvalueCutoff = 0.05, qvalueCutoff = 0.2)
ggobj <- dotplot(down_enrich.go, showCategory = 10) + theme_classic() +
theme(text = element_text(colour = "black", size = 16),
plot.title = element_text(size = 16,color="black",hjust = 0.5),
axis.title = element_text(size = 16,color ="black"),
axis.text = element_text(size= 16,color = "black"))
ggsave("ds2SMC2_down_enrich.svg",device = svg, plot = ggobj, width = 10, height = 6)
ggsave("ds2SMC2_down_enrich2.svg",device = svg, plot = cnetplot(down_enrich.go, showCategory = 8, colorEdge = T), width = 10, height = 6)
emapplot(down_enrich.go, showCategory = 10)
umapplot(ds2)
ds2_markers <- FindMarkers(ds2,ident.1 = "SMC1",min.diff.pct = 0.2, logfc.threshold = 0.5)
| | 0 % ~calculating
|+ | 1 % ~01s
|++ | 3 % ~01s
|+++ | 4 % ~01s
|+++ | 6 % ~01s
|++++ | 7 % ~01s
|+++++ | 9 % ~01s
|++++++ | 10% ~01s
|++++++ | 12% ~01s
|+++++++ | 13% ~01s
|++++++++ | 15% ~01s
|+++++++++ | 16% ~00s
|+++++++++ | 18% ~00s
|++++++++++ | 19% ~00s
|+++++++++++ | 21% ~00s
|++++++++++++ | 22% ~00s
|++++++++++++ | 24% ~00s
|+++++++++++++ | 25% ~00s
|++++++++++++++ | 26% ~00s
|++++++++++++++ | 28% ~00s
|+++++++++++++++ | 29% ~00s
|++++++++++++++++ | 31% ~00s
|+++++++++++++++++ | 32% ~00s
|+++++++++++++++++ | 34% ~00s
|++++++++++++++++++ | 35% ~00s
|+++++++++++++++++++ | 37% ~00s
|++++++++++++++++++++ | 38% ~00s
|++++++++++++++++++++ | 40% ~00s
|+++++++++++++++++++++ | 41% ~00s
|++++++++++++++++++++++ | 43% ~00s
|+++++++++++++++++++++++ | 44% ~00s
|+++++++++++++++++++++++ | 46% ~00s
|++++++++++++++++++++++++ | 47% ~00s
|+++++++++++++++++++++++++ | 49% ~00s
|+++++++++++++++++++++++++ | 50% ~00s
|++++++++++++++++++++++++++ | 51% ~00s
|+++++++++++++++++++++++++++ | 53% ~00s
|++++++++++++++++++++++++++++ | 54% ~00s
|++++++++++++++++++++++++++++ | 56% ~00s
|+++++++++++++++++++++++++++++ | 57% ~00s
|++++++++++++++++++++++++++++++ | 59% ~00s
|+++++++++++++++++++++++++++++++ | 60% ~00s
|+++++++++++++++++++++++++++++++ | 62% ~00s
|++++++++++++++++++++++++++++++++ | 63% ~00s
|+++++++++++++++++++++++++++++++++ | 65% ~00s
|++++++++++++++++++++++++++++++++++ | 66% ~00s
|++++++++++++++++++++++++++++++++++ | 68% ~00s
|+++++++++++++++++++++++++++++++++++ | 69% ~00s
|++++++++++++++++++++++++++++++++++++ | 71% ~00s
|+++++++++++++++++++++++++++++++++++++ | 72% ~00s
|+++++++++++++++++++++++++++++++++++++ | 74% ~00s
|++++++++++++++++++++++++++++++++++++++ | 75% ~00s
|+++++++++++++++++++++++++++++++++++++++ | 76% ~00s
|+++++++++++++++++++++++++++++++++++++++ | 78% ~00s
|++++++++++++++++++++++++++++++++++++++++ | 79% ~00s
|+++++++++++++++++++++++++++++++++++++++++ | 81% ~00s
|++++++++++++++++++++++++++++++++++++++++++ | 82% ~00s
|++++++++++++++++++++++++++++++++++++++++++ | 84% ~00s
|+++++++++++++++++++++++++++++++++++++++++++ | 85% ~00s
|++++++++++++++++++++++++++++++++++++++++++++ | 87% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++ | 88% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++ | 91% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++ | 93% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 94% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 96% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++++ | 97% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 99% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=01s
ds2_markers_pos <- ds2_markers[ds2_markers$avg_logFC>0, ]
ds2_markers_neg <- ds2_markers[ds2_markers$avg_logFC<0, ]
gene_list <- rownames(ds2_markers_pos)
up_enrich.go <- enrichGO(
gene = gene_list, # 基因列表文件中的基因名称
OrgDb = org.Hs.eg.db, keyType = "SYMBOL",
ont = "BP", # 可选 BP、MF、CC,也可以指定 ALL 同时计算 3 者
pAdjustMethod = "fdr", pvalueCutoff = 0.05, qvalueCutoff = 0.2)
ggobj <- dotplot(up_enrich.go, showCategory = 10) + theme_classic() +
theme(text = element_text(colour = "black", size = 16),
plot.title = element_text(size = 16,color="black",hjust = 0.5),
axis.title = element_text(size = 16,color ="black"),
axis.text = element_text(size= 16,color = "black"))
ggsave("ds2SMC1_up_enrich.svg",device = svg, plot = ggobj, width = 10, height = 6)
ggsave("ds2SMC1_up_enrich2.svg",device = svg, plot = cnetplot(up_enrich.go, showCategory = 8, colorEdge = T), width = 10, height = 6)
emapplot(up_enrich.go, showCategory = 10)
##down-regulated genes
gene_list <- rownames(ds2_markers_neg)
down_enrich.go <- enrichGO(
gene = gene_list, # 基因列表文件中的基因名称
OrgDb = org.Hs.eg.db, keyType = "SYMBOL",
ont = "BP", # 可选 BP、MF、CC,也可以指定 ALL 同时计算 3 者
pAdjustMethod = "fdr", pvalueCutoff = 0.05, qvalueCutoff = 0.2)
ggobj <- dotplot(down_enrich.go, showCategory = 10) + theme_classic() +
theme(text = element_text(colour = "black", size = 16),
plot.title = element_text(size = 16,color="black",hjust = 0.5),
axis.title = element_text(size = 16,color ="black"),
axis.text = element_text(size= 16,color = "black"))
ggsave("ds2SMC1_down_enrich.svg",device = svg, plot = ggobj, width = 10, height = 6)
ggsave("ds2SMC1_down_enrich2.svg",device = svg, plot = cnetplot(down_enrich.go, showCategory = 8, colorEdge = T), width = 10, height = 6)
emapplot(down_enrich.go, showCategory = 10)
umapplot(ds2)
ds2_markers <- FindMarkers(ds2,ident.1 = "Fibromyocyte",min.diff.pct = 0.2, logfc.threshold = 0.5)
| | 0 % ~calculating
|+ | 2 % ~00s
|++ | 4 % ~00s
|+++ | 6 % ~00s
|++++ | 8 % ~00s
|+++++ | 10% ~00s
|++++++ | 12% ~00s
|+++++++ | 13% ~00s
|++++++++ | 15% ~00s
|+++++++++ | 17% ~00s
|++++++++++ | 19% ~00s
|+++++++++++ | 21% ~00s
|++++++++++++ | 23% ~00s
|+++++++++++++ | 25% ~00s
|++++++++++++++ | 27% ~00s
|+++++++++++++++ | 29% ~00s
|++++++++++++++++ | 31% ~00s
|+++++++++++++++++ | 33% ~00s
|++++++++++++++++++ | 35% ~00s
|+++++++++++++++++++ | 37% ~00s
|++++++++++++++++++++ | 38% ~00s
|+++++++++++++++++++++ | 40% ~00s
|++++++++++++++++++++++ | 42% ~00s
|+++++++++++++++++++++++ | 44% ~00s
|++++++++++++++++++++++++ | 46% ~00s
|+++++++++++++++++++++++++ | 48% ~00s
|+++++++++++++++++++++++++ | 50% ~00s
|++++++++++++++++++++++++++ | 52% ~00s
|+++++++++++++++++++++++++++ | 54% ~00s
|++++++++++++++++++++++++++++ | 56% ~00s
|+++++++++++++++++++++++++++++ | 58% ~00s
|++++++++++++++++++++++++++++++ | 60% ~00s
|+++++++++++++++++++++++++++++++ | 62% ~00s
|++++++++++++++++++++++++++++++++ | 63% ~00s
|+++++++++++++++++++++++++++++++++ | 65% ~00s
|++++++++++++++++++++++++++++++++++ | 67% ~00s
|+++++++++++++++++++++++++++++++++++ | 69% ~00s
|++++++++++++++++++++++++++++++++++++ | 71% ~00s
|+++++++++++++++++++++++++++++++++++++ | 73% ~00s
|++++++++++++++++++++++++++++++++++++++ | 75% ~00s
|+++++++++++++++++++++++++++++++++++++++ | 77% ~00s
|++++++++++++++++++++++++++++++++++++++++ | 79% ~00s
|+++++++++++++++++++++++++++++++++++++++++ | 81% ~00s
|++++++++++++++++++++++++++++++++++++++++++ | 83% ~00s
|+++++++++++++++++++++++++++++++++++++++++++ | 85% ~00s
|++++++++++++++++++++++++++++++++++++++++++++ | 87% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++ | 88% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++ | 90% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++ | 92% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 94% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++++ | 96% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 98% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s
ds2_markers_pos <- ds2_markers[ds2_markers$avg_logFC>0, ]
ds2_markers_neg <- ds2_markers[ds2_markers$avg_logFC<0, ]
gene_list <- rownames(ds2_markers_pos)
up_enrich.go <- enrichGO(
gene = gene_list, # 基因列表文件中的基因名称
OrgDb = org.Hs.eg.db, keyType = "SYMBOL",
ont = "BP", # 可选 BP、MF、CC,也可以指定 ALL 同时计算 3 者
pAdjustMethod = "fdr", pvalueCutoff = 0.05, qvalueCutoff = 0.2)
ggobj <- dotplot(up_enrich.go, showCategory = 10) + theme_classic() +
theme(text = element_text(colour = "black", size = 16),
plot.title = element_text(size = 16,color="black",hjust = 0.5),
axis.title = element_text(size = 16,color ="black"),
axis.text = element_text(size= 16,color = "black"))
ggsave("ds2Fibromyocyte_up_enrich.svg",device = svg, plot = ggobj, width = 10, height = 6)
ggsave("ds2Fibromyocyte_up_enrich2.svg",device = svg, plot = cnetplot(up_enrich.go, showCategory = 8, colorEdge = T), width = 10, height = 6)
emapplot(up_enrich.go, showCategory = 10)
##down-regulated genes
gene_list <- rownames(ds2_markers_neg)
down_enrich.go <- enrichGO(
gene = gene_list, # 基因列表文件中的基因名称
OrgDb = org.Hs.eg.db, keyType = "SYMBOL",
ont = "BP", # 可选 BP、MF、CC,也可以指定 ALL 同时计算 3 者
pAdjustMethod = "fdr", pvalueCutoff = 0.05, qvalueCutoff = 0.2)
ggobj <- dotplot(down_enrich.go, showCategory = 10) + theme_classic() +
theme(text = element_text(colour = "black", size = 16),
plot.title = element_text(size = 16,color="black",hjust = 0.5),
axis.title = element_text(size = 16,color ="black"),
axis.text = element_text(size= 16,color = "black"))
ggsave("ds2Fibromyocyte_down_enrich.svg",device = svg, plot = ggobj, width = 10, height = 6)
ggsave("ds2Fibromyocyte_down_enrich2.svg",device = svg, plot = cnetplot(down_enrich.go, showCategory = 8, colorEdge = T), width = 10, height = 6)
emapplot(down_enrich.go, showCategory = 10)
umapplot(ds2)
ds2_markers <- FindMarkers(ds2,ident.1 = "Pericyte",min.diff.pct = 0.2, logfc.threshold = 0.5)
ds2_markers_pos <- ds2_markers[ds2_markers$avg_logFC>0, ]
ds2_markers_neg <- ds2_markers[ds2_markers$avg_logFC<0, ]
gene_list <- rownames(ds2_markers_pos)
up_enrich.go <- enrichGO(
gene = gene_list, # 基因列表文件中的基因名称
OrgDb = org.Hs.eg.db, keyType = "SYMBOL",
ont = "BP", # 可选 BP、MF、CC,也可以指定 ALL 同时计算 3 者
pAdjustMethod = "fdr", pvalueCutoff = 0.05, qvalueCutoff = 0.2)
ggobj <- dotplot(up_enrich.go, showCategory = 10) + theme_classic() +
theme(text = element_text(colour = "black", size = 16),
plot.title = element_text(size = 16,color="black",hjust = 0.5),
axis.title = element_text(size = 16,color ="black"),
axis.text = element_text(size= 16,color = "black"))
ggsave("ds2Pericyte_up_enrich.svg",device = svg, plot = ggobj, width = 14, height = 6)
ggsave("ds2Pericyte_up_enrich2.svg",device = svg, plot = cnetplot(up_enrich.go, showCategory = 8, colorEdge = T), width = 10, height = 6)
##down-regulated genes
gene_list <- rownames(ds2_markers_neg)
down_enrich.go <- enrichGO(
gene = gene_list, # 基因列表文件中的基因名称
OrgDb = org.Hs.eg.db, keyType = "SYMBOL",
ont = "BP", # 可选 BP、MF、CC,也可以指定 ALL 同时计算 3 者
pAdjustMethod = "fdr", pvalueCutoff = 0.05, qvalueCutoff = 0.2)
ggobj <- dotplot(down_enrich.go, showCategory = 10) + theme_classic() +
theme(text = element_text(colour = "black", size = 16),
plot.title = element_text(size = 16,color="black",hjust = 0.5),
axis.title = element_text(size = 16,color ="black"),
axis.text = element_text(size= 16,color = "black"))
ggsave("ds2Pericyte_down_enrich.svg",device = svg, plot = ggobj, width = 14, height = 6)
ggsave("ds2Pericyte_down_enrich2.svg",device = svg, plot = cnetplot(down_enrich.go, showCategory = 8, colorEdge = T), width = 10, height = 6)
umapplot(ds1)
ds1_markers <- FindMarkers(ds1,ident.1 = "SMC2",min.diff.pct = 0.2, logfc.threshold = 0.5)
| | 0 % ~calculating
|+ | 1 % ~00s
|++ | 3 % ~00s
|++ | 4 % ~00s
|+++ | 5 % ~00s
|++++ | 7 % ~00s
|++++ | 8 % ~00s
|+++++ | 9 % ~00s
|++++++ | 11% ~00s
|++++++ | 12% ~00s
|+++++++ | 13% ~00s
|++++++++ | 15% ~00s
|++++++++ | 16% ~00s
|+++++++++ | 17% ~00s
|++++++++++ | 19% ~00s
|++++++++++ | 20% ~00s
|+++++++++++ | 21% ~00s
|++++++++++++ | 23% ~00s
|++++++++++++ | 24% ~00s
|+++++++++++++ | 25% ~00s
|++++++++++++++ | 27% ~00s
|++++++++++++++ | 28% ~00s
|+++++++++++++++ | 29% ~00s
|++++++++++++++++ | 31% ~00s
|++++++++++++++++ | 32% ~00s
|+++++++++++++++++ | 33% ~00s
|++++++++++++++++++ | 35% ~00s
|++++++++++++++++++ | 36% ~00s
|+++++++++++++++++++ | 37% ~00s
|++++++++++++++++++++ | 39% ~00s
|++++++++++++++++++++ | 40% ~00s
|+++++++++++++++++++++ | 41% ~00s
|++++++++++++++++++++++ | 43% ~00s
|++++++++++++++++++++++ | 44% ~00s
|+++++++++++++++++++++++ | 45% ~00s
|++++++++++++++++++++++++ | 47% ~00s
|++++++++++++++++++++++++ | 48% ~00s
|+++++++++++++++++++++++++ | 49% ~00s
|++++++++++++++++++++++++++ | 51% ~00s
|++++++++++++++++++++++++++ | 52% ~00s
|+++++++++++++++++++++++++++ | 53% ~00s
|++++++++++++++++++++++++++++ | 55% ~00s
|++++++++++++++++++++++++++++ | 56% ~00s
|+++++++++++++++++++++++++++++ | 57% ~00s
|++++++++++++++++++++++++++++++ | 59% ~00s
|++++++++++++++++++++++++++++++ | 60% ~00s
|+++++++++++++++++++++++++++++++ | 61% ~00s
|++++++++++++++++++++++++++++++++ | 63% ~00s
|++++++++++++++++++++++++++++++++ | 64% ~00s
|+++++++++++++++++++++++++++++++++ | 65% ~00s
|++++++++++++++++++++++++++++++++++ | 67% ~00s
|++++++++++++++++++++++++++++++++++ | 68% ~00s
|+++++++++++++++++++++++++++++++++++ | 69% ~00s
|++++++++++++++++++++++++++++++++++++ | 71% ~00s
|++++++++++++++++++++++++++++++++++++ | 72% ~00s
|+++++++++++++++++++++++++++++++++++++ | 73% ~00s
|++++++++++++++++++++++++++++++++++++++ | 75% ~00s
|++++++++++++++++++++++++++++++++++++++ | 76% ~00s
|+++++++++++++++++++++++++++++++++++++++ | 77% ~00s
|++++++++++++++++++++++++++++++++++++++++ | 79% ~00s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~00s
|+++++++++++++++++++++++++++++++++++++++++ | 81% ~00s
|++++++++++++++++++++++++++++++++++++++++++ | 83% ~00s
|++++++++++++++++++++++++++++++++++++++++++ | 84% ~00s
|+++++++++++++++++++++++++++++++++++++++++++ | 85% ~00s
|++++++++++++++++++++++++++++++++++++++++++++ | 87% ~00s
|++++++++++++++++++++++++++++++++++++++++++++ | 88% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++ | 89% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++ | 91% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++ | 92% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++ | 93% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 95% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 96% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++++ | 97% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 99% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s
ds1_markers_pos <- ds1_markers[ds1_markers$avg_logFC>0, ]
ds1_markers_neg <- ds1_markers[ds1_markers$avg_logFC<0, ]
gene_list <- rownames(ds1_markers_pos)
up_enrich.go <- enrichGO(
gene = gene_list, # 基因列表文件中的基因名称
OrgDb = org.Hs.eg.db, keyType = "SYMBOL",
ont = "BP", # 可选 BP、MF、CC,也可以指定 ALL 同时计算 3 者
pAdjustMethod = "fdr", pvalueCutoff = 0.05, qvalueCutoff = 0.2)
ggobj <- dotplot(up_enrich.go, showCategory = 10) + theme_classic() +
theme(text = element_text(colour = "black", size = 16),
plot.title = element_text(size = 16,color="black",hjust = 0.5),
axis.title = element_text(size = 16,color ="black"),
axis.text = element_text(size= 16,color = "black"))
ggsave("ds1SMC2_up_enrich.svg",device = svg, plot = ggobj, width = 14, height = 6)
ggsave("ds1SMC2_up_enrich2.svg",device = svg, plot = cnetplot(up_enrich.go, showCategory = 8, colorEdge = T), width = 10, height = 6)
emapplot(up_enrich.go, showCategory = 10)
##down-regulated genes
gene_list <- rownames(ds1_markers_neg)
down_enrich.go <- enrichGO(
gene = gene_list, # 基因列表文件中的基因名称
OrgDb = org.Hs.eg.db, keyType = "SYMBOL",
ont = "BP", # 可选 BP、MF、CC,也可以指定 ALL 同时计算 3 者
pAdjustMethod = "fdr", pvalueCutoff = 0.05, qvalueCutoff = 0.2)
umapplot(ds1)
ds1_markers <- FindMarkers(ds1,ident.1 = "SMC1",min.diff.pct = 0.2, logfc.threshold = 0.5)
ds1_markers_pos <- ds1_markers[ds1_markers$avg_logFC>0, ]
ds1_markers_neg <- ds1_markers[ds1_markers$avg_logFC<0, ]
gene_list <- rownames(ds1_markers_pos)
up_enrich.go <- enrichGO(
gene = gene_list, # 基因列表文件中的基因名称
OrgDb = org.Hs.eg.db, keyType = "SYMBOL",
ont = "BP", # 可选 BP、MF、CC,也可以指定 ALL 同时计算 3 者
pAdjustMethod = "fdr", pvalueCutoff = 0.05, qvalueCutoff = 0.2)
ggobj <- dotplot(up_enrich.go, showCategory = 10) + theme_classic() +
theme(text = element_text(colour = "black", size = 16),
plot.title = element_text(size = 16,color="black",hjust = 0.5),
axis.title = element_text(size = 16,color ="black"),
axis.text = element_text(size= 16,color = "black"))
ggsave("ds1SMC1_up_enrich.svg",device = svg, plot = ggobj, width = 10, height = 6)
ggsave("ds1SMC1_up_enrich2.svg",device = svg, plot = cnetplot(up_enrich.go, showCategory = 8, colorEdge = T), width = 10, height = 6)
##down-regulated genes
gene_list <- rownames(ds1_markers_neg)
down_enrich.go <- enrichGO(
gene = gene_list, # 基因列表文件中的基因名称
OrgDb = org.Hs.eg.db, keyType = "SYMBOL",
ont = "BP", # 可选 BP、MF、CC,也可以指定 ALL 同时计算 3 者
pAdjustMethod = "fdr", pvalueCutoff = 0.05, qvalueCutoff = 0.2)
ggobj <- dotplot(down_enrich.go, showCategory = 10) + theme_classic() +
theme(text = element_text(colour = "black", size = 16),
plot.title = element_text(size = 16,color="black",hjust = 0.5),
axis.title = element_text(size = 16,color ="black"),
axis.text = element_text(size= 16,color = "black"))
ggsave("ds1SMC1_down_enrich.svg",device = svg, plot = ggobj, width = 10, height = 6)
ggsave("ds1SMC1_down_enrich2.svg",device = svg, plot = cnetplot(down_enrich.go, showCategory = 8, colorEdge = T), width = 10, height = 6)
umapplot(ds1)
ds1_markers <- FindMarkers(ds1,ident.1 = "Fibromyocyte",min.diff.pct = 0.2, logfc.threshold = 0.5)
ds1_markers_pos <- ds1_markers[ds1_markers$avg_logFC>0, ]
ds1_markers_neg <- ds1_markers[ds1_markers$avg_logFC<0, ]
gene_list <- rownames(ds1_markers_pos)
up_enrich.go <- enrichGO(
gene = gene_list, # 基因列表文件中的基因名称
OrgDb = org.Hs.eg.db, keyType = "SYMBOL",
ont = "BP", # 可选 BP、MF、CC,也可以指定 ALL 同时计算 3 者
pAdjustMethod = "fdr", pvalueCutoff = 0.05, qvalueCutoff = 0.2)
ggobj <- dotplot(up_enrich.go, showCategory = 10) + theme_classic() +
theme(text = element_text(colour = "black", size = 16),
plot.title = element_text(size = 16,color="black",hjust = 0.5),
axis.title = element_text(size = 16,color ="black"),
axis.text = element_text(size= 16,color = "black"))
ggsave("ds1Fibromyocyte_up_enrich.svg",device = svg, plot = ggobj, width = 10, height = 6)
ggsave("ds1Fibromyocyte_up_enrich2.svg",device = svg, plot = cnetplot(up_enrich.go, showCategory = 8, colorEdge = T), width = 10, height = 6)
emapplot(up_enrich.go, showCategory = 10)
##down-regulated genes
gene_list <- rownames(ds1_markers_neg)
down_enrich.go <- enrichGO(
gene = gene_list, # 基因列表文件中的基因名称
OrgDb = org.Hs.eg.db, keyType = "SYMBOL",
ont = "BP", # 可选 BP、MF、CC,也可以指定 ALL 同时计算 3 者
pAdjustMethod = "fdr", pvalueCutoff = 0.05, qvalueCutoff = 0.2)
ggobj <- dotplot(down_enrich.go, showCategory = 10) + theme_classic() +
theme(text = element_text(colour = "black", size = 16),
plot.title = element_text(size = 16,color="black",hjust = 0.5),
axis.title = element_text(size = 16,color ="black"),
axis.text = element_text(size= 16,color = "black"))
ggsave("ds1Fibromyocyte_down_enrich.svg",device = svg, plot = ggobj, width = 10, height = 6)
ggsave("ds1Fibromyocyte_down_enrich2.svg",device = svg, plot = cnetplot(down_enrich.go, showCategory = 8, colorEdge = T), width = 10, height = 6)
emapplot(down_enrich.go, showCategory = 10)
svg("GO_res.svg",height = 8,width = 10)
radarchart(data, axistype=0, seg = 5,
pcol=colors_border, pfcol=colors_in, plwd=1.3 , plty=1,pty=32,
cglcol="black", cglty=3, cglwd=0.6,
)
legend(x=-1.6, y=0.5, legend = rownames(data[-c(1,2),]), bty = "n", pch=20 , col=colors_border, text.col = "black", cex=1, pt.cex=2)
dev.off()
null device
1
Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Ctrl+Alt+I.
When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Ctrl+Shift+K to preview the HTML file).
The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.